package com.ruoyi.generator.controller;

import java.util.concurrent.SynchronousQueue;

public class Demo01 {
    public static void main(String[] args) {
        SynchronousQueue<String> queue = new SynchronousQueue<>();
        new Thread(() -> {
            try {
                System.out.println(queue.take());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
        new Thread(() -> {
            System.out.println(queue.offer("1"));
        }).start();

    }
}
